<!DOCTYPE HTML>
<html>
    <head>
        <title>Example</title>
        <meta name="author" content="Adam Freeman"/>
        <meta name="description" content="A simple example"/>
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
        <style>
            table {
                border: solid thin black;
                border-collapse: collapse;
                margin: 5px 2px;
                float: left;
            }
            td { padding: 4px 5px; }
            p {clear: left};
        </style>
    </head>
    <body>
        <table border="1">
            <thead><tr><th>Fruit</th><th>Color</th></tr></thead>
            <tbody>
                <tr id="applerow"><td>Plum</td><td>Purple</td></tr>
            </tbody>
        </table>
        <textarea  rows="3" id="results"></textarea>
        <p>
            <button id="inner">Inner HTML</button>
            <button id="outer">Outer HTML</button>
        </p>
        <script>
            var results = document.getElementById("results");
            var row = document.getElementById("applerow");
            // inner只返回子元素的HTML
            document.getElementById("inner").onclick = function() {
                results.innerHTML = row.innerHTML;
            };
            // outer返回这个元素及其子元素的HTML
            document.getElementById("outer").onclick = function() {
                results.innerHTML = row.outerHTML;
            }
        </script>
    </body>
</html>
